//模块
import Vue from "vue";
//插件
import VueRouter from "vue-router";

//路由组件
import ShouYe from "../views/ShouYe.vue";
import FenLei from "../views/FenLei.vue";
import Car from "../views/Car.vue";
import WeiLogin from "../views/WeiLogin.vue";

//二级路由组件
import TuiJian from "../views/FenLei/TuiJian.vue";
import ShuMa from "../views/FenLei/ShuMa.vue";
import CaoShi from "../views/FenLei/CaoShi.vue";

//使用插件
Vue.use(VueRouter);

export default new VueRouter({
    mode:"history",
    routes:[
        {
            path:'/shouye',
            name:"shouye",
            component:ShouYe,
        },
        {
            path:"/fenlei",
            name:"fenlei",
            component:FenLei,
            children:[
                {
                    path:"/fenlei/tuijian",
                    name:"tuijian",
                    component:TuiJian
                },
                {
                    path:"/fenlei/shuma",
                    name:"shuma",
                    component:ShuMa
                },
                {
                    path:"/fenlei/caoshi",
                    name:"caoshi",
                    component:CaoShi
                },
                {
                    path:'/',
                    redirect:'/fenlei/tuijian'
                }
            ]
        },
        {
            path:"/car",
            name:"car",
            component:Car
        },
        {
            path:"/weilogin",
            name:"weilogin",
            component:WeiLogin
        },
        {
            // 路由重定向
            path:'/',
            redirect:'/shouye'
        }
    ]
})